package com.cws.project.cws.graduation.project.service.impl;

import java.util.List;

import com.cws.common.utils.DateUtils;
import com.cws.common.utils.text.Convert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cws.project.cws.graduation.project.mapper.GraduationProjectMapper;
import com.cws.project.cws.graduation.project.domain.GraduationProject;
import com.cws.project.cws.graduation.project.service.IGraduationProjectService;

/**
 * 毕设内容Service业务层处理
 *
 * @author xyl
 * @date 2022-01-19
 */
@Service
public class GraduationProjectServiceImpl implements IGraduationProjectService {
    @Autowired
    private GraduationProjectMapper graduationProjectMapper;

    /**
     * 查询毕设内容
     *
     * @param graduationProductId 毕设内容ID
     * @return 毕设内容
     */
    @Override
    public GraduationProject selectGraduationProjectById(Long graduationProductId) {
        return graduationProjectMapper.selectGraduationProjectById(graduationProductId);
    }

    /**
     * 查询毕设内容列表
     *
     * @param graduationProject 毕设内容
     * @return 毕设内容
     */
    @Override
    public List<GraduationProject> selectGraduationProjectList(GraduationProject graduationProject) {
        return graduationProjectMapper.selectGraduationProjectList(graduationProject);
    }

    /**
     * 新增毕设内容
     *
     * @param graduationProject 毕设内容
     * @return 结果
     */
    @Override
    public int insertGraduationProject(GraduationProject graduationProject) {
        return graduationProjectMapper.insertGraduationProject(graduationProject);
    }

    /**
     * 修改毕设内容
     *
     * @param graduationProject 毕设内容
     * @return 结果
     */
    @Override
    public int updateGraduationProject(GraduationProject graduationProject) {
        graduationProject.setUpdateTime(DateUtils.getNowDate());
        return graduationProjectMapper.updateGraduationProject(graduationProject);
    }

    /**
     * 删除毕设内容对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteGraduationProjectByIds(String ids) {
        return graduationProjectMapper.deleteGraduationProjectByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除毕设内容信息
     *
     * @param graduationProductId 毕设内容ID
     * @return 结果
     */
    @Override
    public int deleteGraduationProjectById(Long graduationProductId) {
        return graduationProjectMapper.deleteGraduationProjectById(graduationProductId);
    }

    @Override
    public GraduationProject selectGraduationProjectByStudentId(Long userId) {
        return graduationProjectMapper.selectGraduationProjectByStudentId(userId);
    }
}
